package com.wondertek.poms.dao.po;

import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.Data;
import lombok.experimental.Accessors;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import org.hibernate.annotations.Proxy;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.persistence.Transient;
import java.util.Date;

/**
 * @author evan0213
 * @description
 */
@Data
@Entity
@Table(name = "EQUITY_TREE_ABILITY_LOG")
@DynamicUpdate
@DynamicInsert
@Proxy(lazy = false)
@JsonInclude(JsonInclude.Include.NON_NULL)
@Accessors(chain = true)
public class EquityTreeAbilityLog {
	@Id
	@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "EQUITY_TREE_ABILITY_LOG_SEQ")
	@SequenceGenerator(name = "EQUITY_TREE_ABILITY_LOG_SEQ", allocationSize = 1, sequenceName = "EQUITY_TREE_ABILITY_LOG_SEQ")
	private Long id;
	@Column(name = "TREE_ID")
	private Long treeId;
	@Column(name = "PUSH_RELATION_ID")
	private Long pushRelationId;
	@Column(name = "OPR_TIME")
	private Date oprTime;
	@Column(name = "STATUS")
	private Integer status;//10:推送成功待回复 ; 12:推送成功回复成功;	13:推送失败
	@Column(name = "TYPE")
	private String type;//1:权益树 2:产品组 3:产品包 4:渠道包
	@Column(name = "PUSH_CONTENT_ID")
	private Long pushContentId; //权益树id 产品组id 产品包id 渠道包id
	@Column(name = "NAME")
	private String name;
	@Column(name = "XML_NAME")
	private String xmlName;
	@Column(name = "OPR_CODE")
	private Integer oprCode;//1:发布 2：撤回  3：删除
	@Transient
	private String xml;

	public EquityTreeAbilityLog(){

	}

	public EquityTreeAbilityLog(Long pushContentId,String name,String xmlName,String type,Integer oprCode,Long pushRelationId){
		//this.pushRelationId = 10086l;
		this.pushRelationId = pushRelationId;
		this.oprTime = new Date();
		this.status = 10;
		this.type = type;
		this.pushContentId = pushContentId;
		this.name = name;
		this.xmlName = xmlName;
		this.oprCode = oprCode;
	}
}
